#ifndef PNGIMAGE
#define PNGIMAGE
#include "TextChunk.h"
#include "png.h"
#include <string>
using namespace std;

class PNGImage
{
private:
	//set to false if initializePNGModel has not been called
	bool initialized;
	
	//initialized to NULL
	png_text* text_ptr;
	//initialized to -1
	int      num_text;
	
	png_infop   INFO_PTR;
	png_structp PNG_PTR;
	
	//png_bytepp row_pointers;
	
	bool loadPNGFromFile(string* filename);
	void handlePNGError();
	int handleUnknownChunk(png_structp png_ptr, png_unknown_chunkp chunk);
	bool setTextFieldsWithTextChunk(TextChunk* textChunk);
	
	
public:
	PNGImage();
	~PNGImage();
	
	bool initializePNGModel(string* filename, TextChunk* textChunk);
	bool writeNewImageWithTextChunk(string* newfilename);
};

#endif